package com.databinding.jetpacktesting

import android.os.Bundle
import android.os.PersistableBundle
import androidx.appcompat.app.AppCompatActivity
import androidx.lifecycle.ViewModelProvider
import androidx.lifecycle.ViewModelProvider.AndroidViewModelFactory
import com.databinding.jetpacktesting.room.WordViewModel
import kotlinx.android.synthetic.main.activity_other.*

/**
 * Created by harisucici on 2020/5/9
 * Class description:
 */
class OtherActivity : AppCompatActivity() {
    lateinit var mViewmodel: OtherViewModel
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_other)
        mViewmodel = ViewModelProvider(this, ViewModelProvider.AndroidViewModelFactory.getInstance(application)).get(OtherViewModel::class.java)
        button.setOnClickListener {
            mViewmodel.count++
            button.setText(mViewmodel.count.toString())
        }
    }
}